#include<iostream>
#include<string>
#include<queue>
using namespace std;
typedef struct node *BTree;
typedef struct node{
	char data;
	BTree lchild;
	BTree rchild;
}TNode;
BTree CreateBTree(string str,int i)
{
   int len;
   BTree bt;
   bt=new TNode;
   len=str.size();
   if(i>len-1 || i<=0) return NULL;
   if(str[i]=='#') return NULL;
   bt->data =str[i];
   bt->lchild =CreateBTree(str,2*i); 
   bt->rchild =CreateBTree(str,2*i+1); 	
   return bt;
}#include <iostream>
#include<string>
#include<queue>
using namespace std;
typedef struct node *BTree;
typedef struct node{
	char data;
	BTree lchild;
	BTree rchild;
}TNode;
BTree CreateBTree(string str,int i)
{
   int len;
   BTree bt;
   bt=new TNode;
   len=str.size();
   if(i>len-1 || i<=0) return NULL;
   if(str[i]=='#') return NULL;
   bt->data =str[i];
   bt->lchild =CreateBTree(str,2*i); 
   bt->rchild =CreateBTree(str,2*i+1); 	
   return bt;
}
void PrintAtLevel(BTree T) {  
    static int flag=0;
	queue<BTree>myqueue;  
    myqueue.push(T);  
    while (!myqueue.empty()) {  
        BTree tmp = myqueue.front();  
        if (tmp->lchild != NULL)  
            myqueue.push(tmp->lchild);  
        if (tmp->rchild != NULL)  
            myqueue.push(tmp->rchild);  
        if(flag==0)cout<<tmp->data;
		else cout << " "<< tmp->data ;  
		flag=1;
        myqueue.pop();  
    }  
}  
int main()
{
	BTree T;
	string str;
	cin>>str;
	int i=1;
	T=CreateBTree(str,i);
	if(!T) {
		cout<<"NULL";
		return 0;
	}
	PrintAtLevel(T);
}

